package com.example.mes_common.exception;

import com.example.mes_common.enums.ResultCode;
import com.example.mes_common.result.JsonResult;
import com.example.mes_common.utils.ResultTool;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    // 根据实际自定义的异常统一处理
    @ExceptionHandler(value = BusinessException.class)
    public JsonResult operationError(BusinessException e) {
        return ResultTool.fail(ResultCode.COMMON_FAIL.getCode(), e.getMessage());
    }

}
